<template>
	<view>
		<view class="poFi top-0 bgfff width-100 pad-tb-28 display align-items">
			<view class="fontSize-32 text-align-center width-25" :class="item.id==current?'active':''" v-for="item in nav_list" :key="item.id" @click="change(item.id)">{{item.name}}</view>
		</view>
		<view class="mar-top-120">
			<view class="pad-lr-20 pad-tb-40 bgfff view_bordbottom display-sb align-items-start" v-for="item in list" :key="item.id"> 
				<view class="fontSize-28 col-6">
					<view class="">提现金额：<text class="col-3">￥{{item.money}}</text></view>
					<view class="mar-top-12">申请时间：<text class="col-3">{{item.create_time}}</text></view>
					<view class="mar-top-12" v-if="item.status!=1">审核时间：<text class="col-3">{{item.check_time}}</text></view>
					<view class="mar-top-12">审核状态：<text class="col-3">{{item.status==1?'审核中':item.status==1?'转帐中':item.status==3?'已到账':item.status==4?'到账失败':item.status==9?item.reject_reason:''}}</text></view>
				</view>
				<view class="col-FD6317">{{item.status==1?'审核中':item.status==1?'转帐中':item.status==3?'已到账':item.status==4?'到账失败':item.status==9?'已驳回':''}}</view>
			</view>
			<view class="display-ce align-items flex-wrap mar-top-200" v-if="list.length==0">
				<image src="/static/img/icon10.png" class="proudct-item-icon-27" mode=""></image>
				<view class="mar-top-12 col-9 fontSize-30 text-align-center width-100">空空如也~~~</view>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { ref } from 'vue';
import {withdrawLog} from '../../utils/api'
onLoad(()=>{
	_withdrawLog()
})
onReachBottom(()=>{
	if(page.value>1){
		_withdrawLog()
	}
})
const nav_list = ref([
	{name:'全部',id:0},
	{name:'审核中',id:1},
	{name:'已通过',id:2},
	{name:'未通过',id:3}
])
const page = ref(1)
const list = ref([])
const _withdrawLog =() =>{
	withdrawLog({page:page.value,limit:10,status:current.value}).then(res=>{
		if(res.code==1){
			list.value = list.value.concat(res.data.withdraw.data)
			if(res.data.withdraw.data.length>0){
				page.value++
			}
		}
	})
}
const current = ref<number>(0)
const change =(id:number) =>{
	current.value = id
	page.value = 1
	list.value = []
	_withdrawLog()
}
</script>

<style lang="scss">
@import 'records.scss';
</style>
